/*     */ package com.lmpop.createIndex.search;
/*     */ 
/*     */ import com.lmpop.createIndex.searchModel.Queue;
/*     */ import com.lmpop.createIndex.searchModel.QueueValue;
/*     */ import com.lmpop.createIndex.searchModel.SearchData;
/*     */ import com.lmpop.createIndex.searchModel.SearchModel;
/*     */ import java.io.IOException;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class AreaIndexFiles
/*     */ {
/*     */   public ProperUtil properUtil;
/*     */   private String file_path;
/*     */ 
/*     */   public AreaIndexFiles()
/*     */   {
/*  20 */     this.properUtil = new ProperUtil();
/*  21 */     this.file_path = this.properUtil.getFilePathByModel("area");
/*     */   }
/*     */ 
/*     */   public List getAreaByLevelInfo(String level) throws IOException {
/*  25 */     ArrayList showList = new ArrayList();
/*  26 */     SearchData search = new SearchData();
/*  27 */     ArrayList paraList = new ArrayList();
/*  28 */     paraList.add(new SearchModel("0", "area_level", level));
/*  29 */     showList = search.getSearchInfo(this.file_path, paraList);
/*  30 */     return showList;
/*     */   }
/*     */ 
/*     */   public List getAreaInfo(Map paraMap) throws IOException
/*     */   {
/*  35 */     ArrayList showList = new ArrayList();
/*  36 */     SearchData search = new SearchData();
/*  37 */     ArrayList paraList = new ArrayList();
/*     */ 
/*  39 */     String area_id = ""; String area_name = ""; String up_area_id = "";
/*  40 */     if (paraMap.get("area_id") != null) area_id = paraMap.get("area_id").toString();
/*  41 */     if (paraMap.get("area_name") != null) area_name = paraMap.get("area_name").toString();
/*  42 */     if (paraMap.get("up_area_id") != null) up_area_id = paraMap.get("up_area_id").toString();
/*     */ 
/*  44 */     Queue queue = new Queue(new QueueValue[] { new QueueValue("sort_no", 2, false) });
/*  45 */     paraList.add(new SearchModel("0", "area_id", area_id));
/*  46 */     paraList.add(new SearchModel("0", "area_name", area_name));
/*  47 */     paraList.add(new SearchModel("0", "up_area_id", up_area_id));
/*  48 */     showList = search.getSearchInfo(this.file_path, paraList, queue);
/*  49 */     return showList;
/*     */   }
/*     */ 
/*     */   public String getAreaNameById(String area_id) throws IOException
/*     */   {
/*  54 */     if (area_id.equals("")) return "";
/*  55 */     SearchData search = new SearchData();
/*  56 */     ArrayList paraList = new ArrayList();
/*  57 */     paraList.add(new SearchModel("0", "area_id", area_id));
/*  58 */     ArrayList list = search.getSearchInfo(this.file_path, paraList);
/*  59 */     String area_name = "";
/*  60 */     if ((list != null) && (list.size() > 0)) {
/*  61 */       Hashtable map = (Hashtable)list.get(0);
/*  62 */       if (map.get("area_name") != null) area_name = map.get("area_name").toString();
/*     */     }
/*  64 */     return area_name;
/*     */   }
/*     */ 
/*     */   public Map getAreaClassByUpId(String up_class)
/*     */     throws IOException
/*     */   {
/*  75 */     Map classMap = new Hashtable();
/*  76 */     String area_id = ""; String area_name = "";
/*     */ 
/*  78 */     SearchData search = new SearchData();
/*  79 */     ArrayList paraList = new ArrayList();
/*  80 */     paraList.add(new SearchModel("0", "up_area_id", up_class));
/*  81 */     ArrayList list = search.getSearchInfo(this.file_path, paraList);
/*     */ 
/*  83 */     if ((list != null) && (list.size() > 0)) {
/*  84 */       Map map = new Hashtable();
/*  85 */       for (int i = 0; i < list.size(); i++) {
/*  86 */         map = (Hashtable)list.get(i);
/*  87 */         if (map.get("area_name") != null) {
/*  88 */           area_name = map.get("area_name").toString();
/*     */         }
/*  90 */         if (map.get("area_id") != null) {
/*  91 */           area_id = map.get("area_id").toString();
/*     */         }
/*  93 */         classMap.put(area_id, area_name);
/*     */       }
/*     */     }
/*  96 */     return classMap;
/*     */   }
/*     */ 
/*     */   public String getAreaSelect(String up_area_id) throws IOException {
/* 100 */     SearchData search = new SearchData();
/* 101 */     ArrayList paraList = new ArrayList();
/* 102 */     Queue queue = new Queue(new QueueValue[] { new QueueValue("sort_no", 2, true) });
/*     */ 
/* 104 */     paraList.add(new SearchModel("0", "up_area_id", up_area_id));
/* 105 */     ArrayList list = search.getSearchInfo(this.file_path, paraList, queue);
/* 106 */     StringBuffer areaSelect = new StringBuffer();
/* 107 */     if ((list != null) && (list.size() > 0)) {
/* 108 */       Hashtable map = new Hashtable();
/* 109 */       for (int i = 0; i < list.size(); i++) {
/* 110 */         map = (Hashtable)list.get(i);
/* 111 */         String area_id = ""; String area_name = "";
/* 112 */         if (map.get("area_id") != null) area_id = map.get("area_id").toString();
/* 113 */         if (map.get("area_name") != null) area_name = map.get("area_name").toString();
/* 114 */         String select = "";
/* 115 */         areaSelect.append("<option value='" + area_id + "' " + select + ">" + area_name + "</option>");
/*     */       }
/*     */     }
/* 118 */     return areaSelect.toString();
/*     */   }
/*     */ 
/*     */   public ArrayList getAreaInfoList(String up_area_id)
/*     */     throws IOException
/*     */   {
/* 124 */     SearchData search = new SearchData();
/* 125 */     ArrayList paraList = new ArrayList();
/* 126 */     paraList.add(new SearchModel("0", "up_area_id", up_area_id));
/* 127 */     ArrayList areaList = search.getSearchInfo(this.file_path, paraList);
/* 128 */     return areaList;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.createIndex.search.AreaIndexFiles
 * JD-Core Version:    0.6.0
 */